package de.hwrBerlin.dataMining.view.vImage.figures;

import org.dom4j.Document;
import org.dom4j.Element;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;

public class Oval extends FilledFigure {

    public int width = 0, height = 0;
    
    public Oval(int pX, int pY, int pWidth, int pHeight) {
        x = pX;
        y = pY;
        width = pWidth;
        height = pHeight;
    }

    public void paintImage(GC pGc){
        setValuesToGc(pGc);
        pGc.fillOval(x, y, width, height);
        pGc.drawOval(x, y, width, height);
    }
    @Override
    public Rectangle getBounds() {
        return new Rectangle(0, 0, width, height);
    }

    @Override
    public void paintSVG(Document pDocument) {
        Element root = pDocument.getRootElement();
        
        Element oval = root.addElement("ellipse");
        
        setValuesToSVGElement(oval);
        
        oval.addAttribute("cx", ""+(x+(width/2)));
        oval.addAttribute("cy", ""+(y+(height/2)));
        oval.addAttribute("rx", ""+(width/2));
        oval.addAttribute("ry", ""+(height/2));
    }
    
}
